package com.shangxia.monomer.study.designPatterns.structuralType.facade;

import lombok.extern.slf4j.Slf4j;

/**
 * @ProjectName: monomer
 * @ClassName: FacadeDemo
 * @Time: 2021/7/20
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class FacadeDemo {
    /**
     * 提供了一个统一的接口，用来访问子系统中的一群接口，从而让子系统更容易使用。
     * eg RequestFacade
     *
     * @param args
     */
    public static void main(String[] args) {
        Facade facade = new Facade();
        facade.watchMovie();
    }
}

class SubSystem {
    public void turnOnTV() {
        System.out.println("turnOnTV()");
    }

    public void setCD(String cd) {
        System.out.println("setCD( " + cd + " )");
    }

    public void startWatching() {
        System.out.println("startWatching()");
    }
}

class Facade {
    private SubSystem subSystem = new SubSystem();

    public void watchMovie() {
        subSystem.turnOnTV();
        subSystem.setCD("a movie");
        subSystem.startWatching();
    }
}